package com.qidian.mes.cal.controller;

import com.qidian.mes.cal.mapper.CalPlanTeamMapper;
import com.qidian.mes.cal.service.CalPlanTeamService;
import com.qidian.mes.pojo.cal.CalPlanTeam;
import com.qidian.mes.pojo.cal.CalShift;
import com.qidian.mes.util.pojo.MESResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 04冯虹丹
 * @Company 起点编程
 * @Time 2023/11/2 16:00
 * @Description
 */
@RestController
@CrossOrigin
@RequestMapping("/calPlanTeam")
public class CalPlanTeamController {
    @Autowired
    private CalPlanTeamService calPlanTeamService;

    /**
     * 班组列表查询
     * @param page
     * @param limit
     * @param calPlanTeam
     * @return
     */
    @GetMapping("/list")
    public MESResult list(@RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10") int limit, CalPlanTeam calPlanTeam){
        return calPlanTeamService.list(page,limit,calPlanTeam);
    }

    /**
     * 添加计划班组
     * @param teamId
     * @return
     */
    @GetMapping("/adds")
    public MESResult adds(Long [] teamId){
        return calPlanTeamService.save(teamId,teamId[teamId.length-1]);
    }


    /**
     * 单个删除计划班组
     * @param recordId
     * @return
     */
    @DeleteMapping("/{recordId}")
    public MESResult delete(@PathVariable Long recordId){
        return calPlanTeamService.delete(recordId);
    }

    @GetMapping("/get")
    public MESResult get(Long recordId){
        return calPlanTeamService.getMember(recordId);
    }

}
